<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>登录</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link type="text/css" rel="stylesheet" href="static/css/bootstrap.css" />
	<style type="text/css">
		.panel-info > .panel-heading{
			background-color: #214761;
			color:white;
    		border-color: #214761;
		}
		.panel-info {
		    border-color: #214761;
		}
		body{
			background:url(./static/imgs/bg.jpg);
		}
	</style>
  </head>
  
  <body>
  <br><br><br><br><br><br><br><br><br>
  <div class="container">
  <div class="col-sm-4"></div>
  <div class="col-sm-4">
	  <div class="panel panel-info">
	  <div class="panel-heading">用户激活</div>
	  <div class="panel-body">
    <form action="">
    	<div class="form-group">
    	<label for="phone">联系电话</label>&#12288&#12288&#12288&#12288&#12288&#12288<span id="pherr" class="text-danger"></span>
    	<input class="form-control" id="phone" type="text" placeholder="请输入联系电话" name="phone">
    	</div>
    	
    	<input class="btn btn-primary btn-block" type="button" onclick="active()" value="激活">
    </form>
    </div>
	</div>
    
    </div>
    <div class="col-sm-4"></div>
    </div>
  </body>
  <script type="text/javascript" src="static/js/jquery-1.11.1.min.js"></script>
  <script type="text/javascript">
  var flag=0;

		function active(){
			$("#pherr").text("");
			if($("#phone").val()==""||$("#phone").val()==null){
				$("#pherr").removeClass("text-success");
				$("#pherr").addClass("text-danger");
			    $("#pherr").text("请填写联系电话");
		  		$("#phone").focus();
		  		return;
			}
			
		  $.ajax({ 
		      url:"user/active", 
		      data:{phone:$("#phone").val()},
		      dataType: 'text', 
		      type: 'post', 
		      scriptCharset: 'utf-8',
		      success:function(result){
			
			if(eval("("+result+")")=="0"){
				$("#pherr").removeClass("text-success");
				$("#pherr").addClass("text-danger");
			    $("#pherr").text("联系电话错误");
		  		$("#phone").focus();
				}else if(eval("("+result+")")=="1"){
					window.location.href = "user/tologin";
				}
		  }
		    });
			
		}
		

  </script>
</html>
